package com.loong.ems.controller;

import com.loong.ems.domain.entity.EmpAttendanceRecord;
import com.loong.ems.domain.vo.resp.EmpAttendanceRecordVo;
import com.loong.ems.domain.vo.resp.NameValueResult;
import com.loong.ems.domain.vo.resp.Result;
import com.loong.ems.service.EmpAttendanceRecordService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @author 龙勇-229970722
 * @date 2025-01-03 15:35
 * @description: 考勤记录查看
 */

@RestController
@RequestMapping("/attendance")
@Log4j2
@CrossOrigin
@Tag(name = "考勤信息管理 API" , description = "考勤信息管理 API")
public class EmpAttendanceRecordController {

    @Autowired
    private EmpAttendanceRecordService empAttendanceRecordService;
    @Operation(summary = "获取考勤记录")
    @GetMapping("/list")
    public Result<List<EmpAttendanceRecordVo>> list(){
        return Result.success(empAttendanceRecordService.getListCard());
    }

    /**
     * 获取已打卡人数和未打卡人数
     * @return
     */
    @Operation(summary = "获取已打卡人数和未打卡人数")
    @GetMapping("/count")
    public Result<List<NameValueResult>> count(){
        return Result.success(empAttendanceRecordService.count());
    }

}
